/**
 * 该文件专门为Count组件生成action对象
 */
import { INCREMENT, DECREMENT } from './constant'

// 同步action，即acton的值为为Object类型一般对象
export const createIncrementAction = data => ({ type: INCREMENT, data })
export const createDecrementAction = data => ({ type: DECREMENT, data })

// 同步action，即acton的值为为函数，异步action中一般都会调用action
export const createIncrementAsyncAction = (data, interval) => {
  return dispatch => {
    setTimeout(() => dispatch(createIncrementAction(data)), interval)
  }
}
